package com.kind.basketball.basketballappactivity.Activity;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.GridView;
import android.widget.RadioGroup;

import com.haha.extend.button.StateBitmapImageButton;
import com.kind.basketball.basketballappactivity.Fragment.ExchangeFragment;
import com.kind.basketball.basketballappactivity.Fragment.FindFragment;
import com.kind.basketball.basketballappactivity.Fragment.MeFragment;
import com.kind.basketball.basketballappactivity.Fragment.SplendidFragment;
import com.kind.basketball.basketballappactivity.R;

public class MainBasketballActivity extends AppCompatActivity {

    private RadioGroup gdView;
    private StateBitmapImageButton btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gaisos);
        findView();
        initView();
    }

    private  void findView(){
        gdView= (RadioGroup) findViewById(R.id.radio_cos);
        btn=(StateBitmapImageButton)findViewById(R.id.btn_layout);

    }
    private  void  initView(){
        gdView.setOnCheckedChangeListener(onCheckedChangeListener);
        btn.setOnClickListener(onClickListener);
        showFrament(SplendidFragment.getSlef());

    }

    private  void  showFrament(Fragment fragment){
        FragmentTransaction fragmentTransaction=getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.pg_content,fragment);
        fragmentTransaction.commit();
    }
    private RadioGroup.OnCheckedChangeListener onCheckedChangeListener=new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            switch (checkedId) {
                case R.id.splendid:
                    showFrament(SplendidFragment.getSlef());
                    break;

                case R.id.find:
                    showFrament(FindFragment.getSlef());

                    break;

                case R.id.exchange:
                    showFrament(ExchangeFragment.getSlef());

                    break;

                case R.id.me_cos:
                    showFrament(MeFragment.getSlef());

                    break;

            }
        }
    };
    private View.OnClickListener onClickListener=new View.OnClickListener() {
        @Override
        public void onClick(View v) {


        }
    };

}
